<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Product extends Model
{
    use HasFactory;

    public $fillable = [
        'product_category_id',
        'serial_no',
        'title',
        'description',
        'image',
        'images',
        'price',
        'unit',
        'stock',
        'salenum',
        'content',
        'items',
        'is_show',
        'is_recommend',
        'orderby',
        'readnum',
    ];

    protected $casts = [
        'images' => 'json',
        'items' => 'json',
    ];

    public function category()
    {
        return $this->belongsTo(ProductCategory::class);
    }
}
